package com.hoshiicloud.common.aop;

import java.io.Serializable;
import java.util.Date;


/**
 * <p>
 *
 * @author yl
 * @Title: LogableParam.java
 * </p>
 * <p>
 * @Package: com.hoshiicloud.common.aop
 * <p>
 * @Description: 插入日志参数
 * </p>
 * <p>
 * </p>
 */
public class LogableParam implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 是否记录日志,默认记录日志
     */
    private boolean close = false;

    /**
     * 日志类型 1：为后台日志 2：为前台日志
     */
    private String type;

    /**
     * IP地址
     */
    private String ip;

    /**
     * IP地址归属地
     */
    private String address;

    /**
     * 操作用户
     */
    private Long userId;

    /**
     * createTime : 操作时间
     */
    private Date createTime;

    /**
     * <p>
     * 创建一个新的实例 LogableParam.(不记录日志)
     * </p>
     */
    public LogableParam() {
        super();
        this.close = true;
    }

    /**
     * <p>
     * 创建一个新的实例 LogableParam.(记录日志)
     * </p>
     *
     * @param userId
     * @param ip
     * @param type
     */
    public LogableParam(Long userId, String ip, String type) {
        super();
        this.ip = ip;
        //IpSeeker ipSeeker = IpSeeker.getInstance();
        //this.address = ipSeeker.getAddress(ip);
        this.userId = userId;
        this.type = type;
        this.createTime = new Date();
        this.close = false;
    }

    public boolean isClose() {
        return close;
    }

    public void setClose(boolean close) {
        this.close = close;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        return "LogableParam [close=" + close + ", type=" + type + ", ip=" + ip + ", address=" + address + ", userId="
                + userId + ", createTime=" + createTime + "]";
    }

}
